const p_team = {
    name: "p_team",
    template: `
        <div class="p_team">
            <div id="framework" class="box">
                <c_gasbag text="组织架构"></c_gasbag>
                <div class="organization">
                    <img src="../images/organization.jpg">
                </div>
            </div>
            <div id="staff" class="box">
                <c_gasbag text="员工成长"></c_gasbag>
                <div class="staffImg">
                    <img src="../images/staff.png">
                </div>
            </div>
            <div id="elegantFemeanour" class="box">
                <c_gasbag text="风采展示"></c_gasbag>
                <div class="elegantFemeanourImg">
                    <img src="../images/elegantFemeanourImg.png">
                </div>
            </div>
            <c_gasbag id="news" text="新闻动态"></c_gasbag>
        </div>
    `,
    data() {
        return {
            swiper: null,
            eleImageList: []
        }
    },
    created() {
        sendRequest("recommend", {
            pid: 2
        }).then(res => {
            const { success, data } = res;
            if (success) {
                data.banner.map(item => {
                    this.eleImageList.push(item.cover_img);
                })
            }
        })
    },
    mounted() {
        // this.eleBanner();
        /**
         * 原风采展示轮播图
         <div>
            <div class="eleSwiper-prev" @click="eleBannerSlide('Prev')"></div>
            <div class="eleList">
                <div class="swiper-wrapper">
                    <div class="swiper-slide" v-for="(item,index) in eleImageList" :key="index" @click="showImage(index)">
                        <a href="javascript:void(0)">
                            <img :src="item">
                        </a>
                    </div>
                </div>
            </div>
            <div class="eleSwiper-next" @click="eleBannerSlide('Next')"></div>
        </div>
         */
    },
    methods: {
        // 风采展示轮播图
        eleBanner() {
            const swiperOptions = {
                speed: 1000, // 速度
                centeredSlides: true, // 网格布局
                slidesPerView: 3,// 网格数量
                slidesPerGroup: 3,
                spaceBetween: mobile ? 10 : 30,
                slidesPerColumnFill: "row",
                slidesPerColumn: 2,
                centeredSlidesBounds: true,
                freeMode: true,
                observer: true,
                observeParents: true,
            };
            this.swiper = new Swiper(".eleList", swiperOptions);
        },
        // 风采展示轮播图滑动
        eleBannerSlide(funName) {
            this.swiper[`slide${funName}`]();
        },
        showImage(index) {
            bus.$emit("showImage", {
                index,
                list: this.eleImageList
            })
        }
    }
}
Vue.component("p_team", p_team);